package com.imon.meere.dao;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

@Component
public class CourseDaoImpl implements CourseDao {
	private static final Log LOG = LogFactory.getLog(CourseDaoImpl.class);

	@PersistenceContext
	private final EntityManager entityManager;

	public CourseDaoImpl() {
		entityManager = null;
	}

	@Transactional
	@Override
	public void save(final Course aCourse) {
		LOG.debug(String.format("Saving %s", aCourse));
		entityManager.persist(aCourse);
	}
}
